package com.travel.config.api;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
//swaggerui说明文档
@Configuration
public class OpenApiConfig {
    
    @Bean
    public OpenAPI openAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("旅游指南 API")
                        .description("旅游指南应用程序 API 文档")
                        .version("1.0版本")
                        .license(new License()
                                .name("开源协议")
                                .url("https://springdoc.org")))
                .addSecurityItem(new SecurityRequirement().addList("JWT认证"))
                .components(new io.swagger.v3.oas.models.Components()
                        .addSecuritySchemes("JWT认证", new SecurityScheme()
                                .type(SecurityScheme.Type.HTTP)
                                .scheme("bearer")
                                .bearerFormat("JWT")
                                .description("请输入JWT令牌")));
    }
} 